package com.fzshang.shopping.api.controller;


import com.fzshang.shopping.commen.bean.Feedback;
import com.fzshang.shopping.commen.bean.FeedbackClassification;
import com.fzshang.shopping.commen.bean.layuiBean.ResultPage;
import com.fzshang.shopping.commen.bean.layuiBean.VoPage;
import com.fzshang.shopping.commen.controller.BaseController;
import com.fzshang.shopping.commen.entity.ApiResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 冯政尚
 * @since 2020-03-12
 */
@Controller
@RequestMapping("admin/feedbackClassification")
public class FeedbackClassificationController extends BaseController {


    @RequestMapping(value = "feedbackClassification.html")
    public String feedbackClassification(){
        return "admin/feedbackClassification/feedbackClassification";
    }
    @RequestMapping(value = "feedbackClassification_add.html")
    public String feedbackClassification_add(){
        return "admin/feedbackClassification/feedbackClassification_add";
    }

    /**
     * @param voPage
     * @return 后台查询
     */
    @RequestMapping(value = "selectMyPage",method = RequestMethod.GET)
    @ResponseBody
    public ResultPage<FeedbackClassification> selectMyPage(VoPage voPage ){
        return feedbackClassificationService.selectMyPage(voPage);
    }

    /**
     * @param feedbackClassification
     * @return 添加
     */
    @RequestMapping(value = "save")
    @ResponseBody
    public ApiResult save(@RequestBody FeedbackClassification feedbackClassification){
        feedbackClassification.setCreateTime(System.currentTimeMillis());
        if(feedbackClassificationService.save(feedbackClassification)){
            return ApiResult.ok();
        }
        return ApiResult.fail();
    }

    /**
     * @param id
     * @return 删除
     */
    @RequestMapping(value = "deleteById")
    @ResponseBody
    public ApiResult deleteById( Long id){
        if(feedbackClassificationService.removeById(id)){
            return ApiResult.ok();
        }
        return ApiResult.fail();
    }

}
